Skip to content

Conversation

@alenakhineika
Copy link
Contributor

Allow users to add custom entries to mongosh logs in their scripts.

log.info('This is an info message');
log.warn('Warning!');

The custom log message will sequentially appear alongside internal mongosh messages, and will look similar to this:

{"t":{"$date":"2025-01-06T16:14:23.023Z"},"s":"I","c":"MONGOSH","id":1000000012,"ctx":"shell-api","msg":"Loading file via load()","attr":{"nested":false,"filename":"/Users/alena.khineika/custom-logging.js"}}
{"t":{"$date":"2025-01-06T16:14:23.041Z"},"s":"I","c":"MONGOSH-SCRIPTS","id":1000000054,"ctx":"custom-log","msg":"This is an info message"}
{"t":{"$date":"2025-01-06T16:14:23.041Z"},"s":"W","c":"MONGOSH-SCRIPTS","id":1000000054,"ctx":"custom-log","msg":"Warning!"}

@mongodb-js mongodb-js deleted a comment from evergreen-ci-prod bot Jan 17, 2025
@alenakhineika alenakhineika marked this pull request as ready for review January 22, 2025 16:21
@alenakhineika alenakhineika merged commit 03a4dfc into main Jan 29, 2025
135 checks passed
@alenakhineika alenakhineika deleted the MONGOSH-1989-custom-log-entries branch January 29, 2025 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants